<?php
require_once("levelView.php");
require_once(CORE_DIR.'levelModel.php');

class deleteAction extends authAction{

	function __construct(){
		$this->view = new levelView();
	}

	public function run($get, $post, $viewtype) {
		parent::run($get,$post,$viewtype);
		
		$lModel = new levelModel();	 	
		
		if (isset($get["level"])){
			$level = $get["level"];
			
			$status = 0;
			if(isset($get["pointTypeId"]))
			{
				$pointTypeId = isset($get["pointTypeId"]);
				if ($lModel->deleteLevelByPointTypeId($level, $pointTypeId)){
					$status = 1;
				}
			}			
			else
			{
				if ($lModel->deleteLevel($level)){
					$status = 1;
				}
			}
			
			$this->view->setProperty("status", $status);
			$this->view->setProperty("id", $id);
			$this->view->showDeleteLevel();
		}
		else{
			$this->view->showBadCmd();
		}	
			
	}
}
?>